<template>
<view class="orders">
  <view class="tabs">
    <view
      v-for="(t,i) in tabs"
      :key="t.key"
      class="tab"
      :class="{ active: i===activeTab }"
    >
      <text>{{ t.name }}</text>
      <view class="bar" v-if="i===activeTab"></view>
    </view>
  </view>

  <view class="list">
    <view class="item" v-for="(o,idx) in orders" :key="idx">
      <view class="item__hd">
        <text class="title">订单编号：{{ o.no }}</text>
        <text class="arrow">›</text>
      </view>

      <view class="row"><text class="label">服务项目：</text><text class="val">{{ o.service }}</text></view>
      <view class="row">
        <text class="label">服务门店：</text>
        <text class="val">{{ o.store }}</text>
        <text class="loc">🧭</text>
        <text class="status" :class="o.statusType">{{ o.statusText }}</text>
      </view>
      <view class="row"><text class="label">下单时间：</text><text class="val">{{ o.time }}</text></view>

      <view class="item__ft">
        <view class="pay"><text>实付：</text><text class="money">{{ o.pay }}元</text></view>
        <view class="actions">
          <view v-if="o.action==='comment'" class="btn ghost">立即评价</view>
          <view v-else class="btn primary">再来一单</view>
        </view>
      </view>
    </view>
  </view>
</view>
</template>

<script>
export default {
  name: 'OrdersPage',
  data() {
    return {
      tabs: [
        { key: 'all', name: '全部' },
        { key: 'unpaid', name: '待支付' },
        { key: 'unused', name: '待使用' },
        { key: 'tocomment', name: '待评价' }
      ],
      activeTab: 0,
      orders: [
        { no: '24255252522', service: '车辆保养', store: '大宝车辆维修店', time: '2022-20-20 12:09', pay: 200, statusText: '待评价', statusType: 'warning', action: 'comment' },
        { no: '24255252522', service: '车辆保养', store: '大宝车辆维修店', time: '2022-20-20 12:09', pay: 200, statusText: '已取消', statusType: 'muted', action: 'reorder' },
        { no: '24255252522', service: '车辆保养', store: '大宝车辆维修店', time: '2022-20-20 12:09', pay: 200, statusText: '已退款', statusType: 'muted', action: 'reorder' },
        { no: '24255252522', service: '车辆保养', store: '大宝车辆维修店', time: '2022-20-20 12:09', pay: 200, statusText: '已完成', statusType: 'muted', action: 'reorder' }
      ]
    }
  }
}
</script>

<style>
.orders {
  background: #ffffff;
  min-height: 100vh;
}

.tabs {
  display: flex;
  height: 92rpx;
  align-items: flex-end;
  padding: 0 24rpx;
  border-bottom: 1rpx solid #f0f0f0;
}

.tab {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #606266;
  font-size: 28rpx;
}

.tab.active {
  color: #2b5cf9;
}

.tab .bar {
  width: 60rpx;
  height: 6rpx;
  background: #2b5cf9;
  border-radius: 6rpx;
  margin-top: 14rpx;
}

/* 无筛选区 */

.list {
  padding: 16rpx 16rpx 40rpx;
}

.item {
  background: #fff;
  border-radius: 16rpx;
  box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
  padding: 20rpx 20rpx 12rpx;
  margin-bottom: 16rpx;
}
 
.item__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.title {
  font-size: 28rpx;
  color: #1f1f1f;
  font-weight: 600;
}

.arrow {
  font-size: 36rpx;
  color: #bfbfbf;
}
.row {
  display: flex;
  align-items: center;
  margin-top: 10rpx;
}

.label {
  color: #8c8c8c;
  font-size: 26rpx;
}

.val {
  color: #333;
  font-size: 26rpx;
}

.loc {
  margin-left: 8rpx;
  font-size: 24rpx;
}

.status {
  margin-left: auto;
  font-size: 26rpx;
}

.status.warning { color: #fa8c16; }
.status.muted { color: #bfbfbf; }

.item__ft {
  margin-top: 14rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pay {
  color: #8c8c8c;
  font-size: 26rpx;
}

.money {
  color: #ff4d4f;
  font-weight: 700;
  margin-left: 6rpx;
}

.actions { display: flex; gap: 16rpx; }

.btn {
  padding: 12rpx 22rpx;
  border-radius: 12rpx;
  font-size: 26rpx;
}

.btn.ghost {
  color: #2b5cf9;
  border: 1rpx solid #2b5cf9;
}

.btn.primary {
  background: #2b5cf9;
  color: #fff;
}
</style>